<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.model.Guestbook" %><%--
  Created by IntelliJ IDEA.
  User: L
  Date: 2021/8/23
  Time: 10:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--引用标签库 taglib--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="pager" uri="http://blog.zjjlive.net/zjjlive/tags/pager" %>

<html>
<head>
    <title>Title</title>
    <link href="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.12/dist/css/bootstrap.min.css" rel="stylesheet">
</head>

<body>

        <div class="container">
<%--            默认是存requestScope中取key  获取对应的value--%>
<%--    ${sessionScope.username=tomaaa}--%>

            用户名：${sessionScope.username}
            <table class="table table-hover">
                <tr>
                    <td>编号</td>
                    <td>姓名</td>
                    <td>电话</td>
                    <td>邮箱</td>
                    <td>标题</td>
                    <td>内容</td>
                    <td>时间</td>
                    <td>操作</td>
                </tr>
<%--                <%--%>
<%--                    //要从request中获取到list集合，在对集合进行遍历输出--%>
<%--                  List<Object> list= (List<Object>) request.getAttribute("list");--%>

<%--                    for (int i = 0; i < list.size(); i++) {--%>
<%--                        Guestbook gb= (Guestbook) list.get(i);--%>
<%--                %>--%>


<%--               默认从requestScope作用域中获取list集合  ${list}=${requestScope.list} --%>
                <c:forEach var="gb" items="${sessionScope.list}" >


                <tr>

                    <td>${gb.id}</td>
                    <td>${gb.name}</td>
                    <td>${gb.phone}</td>
                    <td>${gb.email}</td>
                    <td>${gb.title}</td>
                    <td>${gb.content}</td>
                    <td>${gb.createdtime}</td>
                    <td>

                        <%--超链接写全路径--%>
<%--                        <a href="/MS/update.jsp?id=${gb.id}&q=update" class="btn btn-primary">修改</a>--%>
                        <a href="/MS/AddMessage.jsp"  class="btn btn-info">添加</a>
                        <a href="/MS/user/manager?uid=${gb.id}&q=getQueryById" class="btn btn-primary">修改</a>
                        <a href="/MS/user/manager?id=${gb.id}&q=delete" class="btn btn-danger">删除</a>
<%--                        req.getRequestDispatcher("/user/manager?q=list").forward(req,resp);--%>

                    </td>
                </tr>
                </c:forEach>


            </table>
        <div>
            <pager:pager pageNo="" recordCount="" pageSize="" url=""/>
        </div>

        </div>


</body>
</html>
